package com.benson.notactionbarldrawer;

import android.app.Activity;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import com.benson.notactionbarldrawer.view.DrawerArrowDrawable;


public class MainActivity extends Activity {
    DrawerArrowDrawable drawerArrowDrawable;
    DrawerLayout   mDrawerLayout;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        drawerArrowDrawable= (DrawerArrowDrawable) findViewById(R.id.arrow);
        mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawerArrowDrawable.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(!mDrawerLayout.isDrawerOpen(Gravity.START)) {
                    mDrawerLayout.openDrawer(Gravity.START);
                }else {
                    mDrawerLayout.closeDrawer(Gravity.START);
                }
            }
        });

        mDrawerLayout.setDrawerListener(new DrawerLayout.DrawerListener() {
            @Override
            public void onDrawerSlide(View view, float v) {
                drawerArrowDrawable.setProgress(v);
            }

            @Override
            public void onDrawerOpened(View view) {

            }

            @Override
            public void onDrawerClosed(View view) {

            }

            @Override
            public void onDrawerStateChanged(int i) {

            }
        });
    }



}
